<template>
    <el-row :gutter="20">
        <el-col :span="24">
            <el-container>
                <el-header>
                    <el-col :span="24">
                        <div class="grid-content bg-purple-dark">
                        <el-menu  class="el-menu-demo" mode="horizontal">
                        <el-menu-item index="4">
                            <el-avatar :size="50" :src="user.userLoginType=='QQ'?user.userQqImg:user.userImg"></el-avatar>
                            {{user.userLoginType=='QQ'?user.userQqNickname:user.userName}}</el-menu-item>
                        <el-menu-item index="3" @click="tuichu()">注销登录</el-menu-item>
                        </el-menu>
                        </div>
                    </el-col>
                </el-header>
                <el-container>
                    <!-- 列表 -->
                    <el-aside width="200px">
                        <el-row class="tac">
                            <el-col :span="20">
                        <el-menu default-active="2" class="el-menu-vertical-demo" @select="select">
                        <el-submenu index="/main">
                        <template slot="title">
                        <i class="el-icon-menu"></i>
                        <span>门店管理</span>
                        </template>
                        <el-menu-item-group>
                        <el-menu-item index="/main/showTask" @click="store">  <i class="el-icon-location"></i>门店资料</el-menu-item>
                        </el-menu-item-group>
                    </el-submenu>
                    <el-submenu index="2">
                        <template slot="title">
                        <i class="el-icon-menu"></i>
                        <span>仓库管理</span>
                        </template>
                        <el-menu-item-group>
                        <el-menu-item index="/main/showStaff" @click="warehouse">  <i class="el-icon-location"></i>仓库配置</el-menu-item>
                        </el-menu-item-group>
                    </el-submenu>
                    <el-submenu index="3">
                        <template slot="title">
                        <i class="el-icon-menu"></i>
                        <span>商品配置</span>
                        </template>
                        <el-menu-item-group>
                        <el-menu-item index="/main/bigSort">  <i class="el-icon-location"></i>商品大类</el-menu-item>
                        
                        
                        <el-menu-item index="1-1" @click="property">  <i class="el-icon-location"></i>商品信息</el-menu-item>
                        <el-menu-item index="/main/smallSort">  <i class="el-icon-location"></i>商品小类</el-menu-item>
                        <el-menu-item index="/main/brand">  <i class="el-icon-location"></i>品牌管理</el-menu-item>
                        

                        </el-menu-item-group>
                    </el-submenu>
                    <el-submenu index="4">
                        <template slot="title">
                        <i class="el-icon-menu"></i>
                        <span>评估鉴定</span>
                        </template>
                        <el-menu-item-group>
                        <el-menu-item index="/main/goodsShow">  <i class="el-icon-location"></i>商品列表</el-menu-item>
                        </el-menu-item-group>
                    </el-submenu>
                    <el-submenu index="5">
                        <template slot="title">
                        <i class="el-icon-menu"></i>
                        <span>渠道商管理</span>
                        </template>
                        <el-menu-item-group>
                        <el-menu-item index="/main/channelShow">  <i class="el-icon-location"></i>渠道商</el-menu-item>
                        </el-menu-item-group>
                    </el-submenu>
                    </el-menu>
                </el-col>
            </el-row>
                    </el-aside>
                    <el-main>
                        <!-- 数据显示位置 -->
                        <el-col :span="20">
                            <el-container>
                            <el-header>
                                <!-- <div > -->
                                    <div style="float:left">
                                        <i class="el-icon-s-home"></i>
                                        <span> > 主页</span>
                                    </div>
                                    <div style="float:right">
                                        <el-button @click="renovate" type="info">刷 新</el-button>
                                    </div>
                                    <div style="clear:both"></div>
                                <!-- </div> -->

                            </el-header>
                            <el-main>
                                <router-view/>
                            </el-main>
                            </el-container>
                        </el-col>
                    </el-main>
                </el-container>
            </el-container>
        </el-col>
    </el-row>

</template>
<script>
export default {
    name:'Main',
    data(){
        return{
            user:{},
        }
        
    },
    methods:{
		property(){
			this.$router.push("/main/property");
		},
		store(){
			this.$router.push("/main/store");
		},
		warehouse(){
			this.$router.push("/main/warehouse");
		},
        select(path){
            this.$router.push(path);
        },
        renovate(){
            this.$router.push("index");
        },
        tuichu(){
            localStorage.removeItem('jwt');
            this.$router.push("/");
        },
        userMessage(){
            this.$http.get("findUserMassage")
                    .then(resp => {
                        console.log(resp);
                        let data = resp.data;
                        if (data.state) {
                            this.user=data.data;
                            console.log(this.user);
                        } else {
                            alert(data.massage);
                        }


		

                    })
                    .catch(error => {
                        console.log(error);
                    })
		
			
		}
    },
    // watch: {//使用路由传参时使用
    //     '$route' (to, from) {
    //         //刷新参数放到这里里面去触发就可以刷新相同界面了
    //         console.log(111111);
    //         console.log(to);
    //         console.log(from);
    //         // this.artiacleId=this.$route.params.detailsId;
    //     }
    // },
	
    created(){
            this.userMessage();
    }
	
}
</script>